package com.cskaoyan.controller.vx.wangdi;

import com.cskaoyan.bean.Brand;
import com.cskaoyan.bean.Goods;
import com.cskaoyan.bo.vx.wangdi.GoodsListBo;
import com.cskaoyan.service.GoodsService;
import com.cskaoyan.service.vx.wangdi.VxBrandService;
import com.cskaoyan.vo.BaseRespVo;
import com.cskaoyan.vo.BrandVO;
import com.cskaoyan.vo.vx.wangdi.Brandvo;
import com.cskaoyan.vo.vx.wangdi.VxBrandVo;
import com.cskaoyan.vo.vx.wangdi.VxGoodsVo;
import org.apache.ibatis.annotations.Param;
import org.aspectj.weaver.ast.Var;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.ArrayList;
import java.util.List;

@RestController
public class VxBrandController {
    @Autowired
    VxBrandService vxBrandService;

    @Autowired
    GoodsService goodsService;

    @RequestMapping("wx/brand/list")
    public BaseRespVo list(Integer page,Integer size){
        VxBrandVo vxBrandVo = vxBrandService.list(page,size);
        return BaseRespVo.ok(vxBrandVo);
    }

    @RequestMapping("wx/brand/detail")
    public BaseRespVo detail(@Param("id") Integer id){
        Brand brand = vxBrandService.detail(id);
        ArrayList<Brand> brands = new ArrayList<>();
        brands.add(brand);
        Brandvo brandvo = new Brandvo();
        brandvo.setBrand(brands);
        return BaseRespVo.ok(brandvo);
    }

    //wx/goods/list?brandId=1001002&page=1&size=100
//    @RequestMapping("wx/goods/list")
//    public BaseRespVo goodList(Integer brandId ,Integer page, Integer size){
//        GoodsListBo goodsListBo = goodsService.goodsListBo(brandId,page,size);
//        return BaseRespVo.ok(goodsListBo);
//    }
}
